package configuration

import (
	"encoding/json"
	"kop/modules/configuration/client"
	"kop/util/log"
)

func init() {

	var data []Day7Conf
	if err := json.Unmarshal(client.Load("ActivitySevenDays"), &data); err != nil {
		panic(err)
	}

	Day7Configs = make(map[int32]Day7Conf)
	for _, v := range data {
		Day7Configs[v.Day] = v
	}
	log.Info("Load ActivitySevenDays.json success.")

	//*****************************************************************************************//
}

// 七天活动配置
type Day7Conf struct {
	Day        int32 `json:"ID"` // 天数
	CaptainID  int32 // 船长ID
	MaidID     int32 // 侍女ID
	ItemID1    int32 // 物品ID1
	ItemCount1 int32 // 物品数量1
	ItemID2    int32 // 物品ID2
	ItemCount2 int32 // 物品数量2
	ItemID3    int32 // 物品ID3
	ItemCount3 int32 // 物品数量3
	ItemID4    int32 // 物品ID4
	ItemCount4 int32 // 物品数量4
}

var Day7Configs map[int32]Day7Conf

func GetDay7Conf(day int32) Day7Conf {

	if conf, ok := Day7Configs[day]; !ok {
		panic("Day7Conf error")
	} else {
		return conf
	}
}
